<html>
<head>
</head>
<body>
<script type="text/javascript">
var force_https_regex;
function updateList()
{
	var list = (localStorage["force_https_list"] ? JSON.parse(localStorage["force_https_list"]) : []);
	force_https_regex = [];
	for(var i = 0; i < list.length; ++i)
	{
		force_https_regex[i] = new RegExp(list[i].pattern, list[i].modifiers || "");
	}
}
updateList();
chrome.experimental.webRequest.onBeforeRequest.addListener((function (details)
{
	for(var i = 0; i < force_https_regex.length; ++i)
		if(force_https_regex[i].test(details.url))
			return {redirectUrl : details.url.replace(/^http:\/\//i, "https://")};
}), {}, ["blocking"]); //Note that blocking is required because we have to redirect before the HTTP request is made
</script>
</body>
</html>
